home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_46372.txt < prev    next >
Text File  |  1991-02-27  |  752b  |  20 lines

  1. -- card: 46372 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. This last statement demonstrates the C ASSIGNMENT OPERATOR '='.  This operator assigns the value of its rightmost operand to the leftmost operand.  Since '=' is an operator, however, the assignment expression has a value of its own: THE VALUE WHICH WAS ASSIGNED.  Therefore in the following example the value of '(a=6)' is 6, so the value 12 is assigned to the integer variable b:
  11.  
  12.     int    a;
  13.     int    b;
  14.     b = 2 * (a=6);
  15.  
  16. In this example the variable 'a' is assigned the value 6 as a "side effect" of the expression '2 * (a=6)'.
  17.  
  18. -- part contents for background part 7
  19. ----- text -----
  20. 53